package pucp.carpooling.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import pucp.carpooling.R;

public class ListViewAdapterVehiculos extends BaseAdapter {

	// Declare Variables
	Context context;
	String[] idvehiculo,vehiculo, placa, asiento, combustible;
	int[] fotoVehiculo;
	LayoutInflater inflater;

	public ListViewAdapterVehiculos(Context context, String[] idvehiculo, String[] vehiculo, String[] placa,
			String[] asiento, String[]combustible, int[] flag) {
		this.context = context;
		this.vehiculo=vehiculo;
		this.placa=placa;
		this.asiento=asiento;
		this.idvehiculo=idvehiculo;
		this.combustible=combustible;
		this.fotoVehiculo = flag;
	}

	public int getCount() {
		return vehiculo.length;
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {

		// Declare Variables
		TextView txtVehiculo, txtPlaca, txtAsiento, txtCombustible;
		ImageView imgflag;

		inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View itemView = inflater.inflate(R.layout.listview_item_vehiculos, parent, false);

		
		txtVehiculo = (TextView) itemView.findViewById(R.id.txtModeloVehiculo);
		txtPlaca = (TextView) itemView.findViewById(R.id.txtPlaca);
		txtAsiento = (TextView) itemView.findViewById(R.id.txtAsientos);
		txtCombustible = (TextView) itemView.findViewById(R.id.txtCombustible);
		imgflag = (ImageView) itemView.findViewById(R.id.flagconductor);

		
		txtVehiculo.setText(vehiculo[position]);
		txtPlaca.setText(placa[position]);
		txtAsiento.setText(asiento[position]);
		txtCombustible.setText(combustible[position]);
		imgflag.setImageResource(fotoVehiculo[position]);

		return itemView;
	}

	
}
